﻿using System;
using System.Collections.Generic;
using System.Domain.Entity;
using System.Domain.IRepository;
using System.Text;
using Application.Infrastructure;
using Domain.Infrastructure;

namespace System.Application
{
    public class SysRoleService : BaseService_C_M_D<SysRoleEntity>
    {
        private readonly ISysRoleRepository _repository;
        public SysRoleService(ILog log, ISysRoleRepository repository) : this(log, repository, "")
        {
        }
        public SysRoleService(ILog log, ISysRoleRepository repository, string userId) : base(log, repository, userId)
        {
            _repository = repository;
        }

        public bool Insert(SysRoleEntity roleEntity, string[] permissionIds)
        {
            try
            {
                return _repository.Insert(roleEntity, permissionIds);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public bool Update(SysRoleEntity roleEntity, string[] permissionIds)
        {
            try
            {
                return _repository.Update(roleEntity, permissionIds);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
    }
}
